var clientData = {
    Commands: {
        gameStart: "gameStart",
        gameEnd: "gameEnd",
        addScore: "addScore",
        userItem: "userItem"
    },
    userData: {
        restScore: 3000,
        gameScore: 0,
        winItem: null,
        nftItems: { 1: 0, 2: 0, 3: 0 }
    },
    getRandomInt(min, max) {
        return Math.floor(Math.random() * (max - min) + min);
    },
    onGameStart() {
        this.userData.gameScore = 0
        this.userData.winItem = null
    },
    onGameEnd(result) {
        if (result) {
            let idx = this.getRandomInt(1, 4)
            this.userData.winItem = idx
            for (let k in this.userData.nftItems) {
                console.log(typeof k, k)
                if (k == idx) {
                    this.userData.nftItems[k]++
                }
            }
        }
    },
    onAddScore() {
        this.userData.gameScore++
    }

}
module.exports = clientData;